import jwt from 'jsonwebtoken';
const SIGN_KEY = "hello jwt.3gweb";
export function sign(id: string) {
  return new Promise((resolve, reject) => {
    resolve(jwt.sign({ id: id }, SIGN_KEY,{expiresIn:"100d"}));
  })
}
export function vaild(token: string) {
  return new Promise((resolve, reject) => {
    jwt.verify(token, SIGN_KEY, function (err, decoded) {
      if (err) {
        reject(err)
      }
      resolve(decoded)
    })
  })
}